package com.cnplan.service.impl;

import com.cnplan.entity.ArcRollImage;
import com.cnplan.mapper.ArcRollImageMapper;
import com.cnplan.service.ArcRollImageService;
import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;
import java.util.Map;

@Service
public class ArcRollImageServiceImpl implements ArcRollImageService {

    @Autowired
    private ArcRollImageMapper arcRollImageMapper;

    @Override
    public PageInfo findByArcRollImage(Map map) {
        if(!map.containsKey("pageNo")){
            map.put("pageNo",1);
        }
        if(!map.containsKey("pageSize")){
            map.put("pageSize",10);
        }
        PageHelper.startPage(Integer.parseInt(map.get("pageNo").toString()),
                Integer.parseInt(map.get("pageSize").toString()));
        List<ArcRollImage> List=arcRollImageMapper.selectArcRollImage(map.get("ctId").toString().trim());
        PageInfo pageInfo = new PageInfo(List);
        return pageInfo;
    }

    @Override
    public List<ArcRollImage> findAllRollImage(String stId) {
        return arcRollImageMapper.findAllRollImage(stId);
    }

    @Override
    public PageInfo findByAllRollImageList(String pageNo, String pageSize) {
        PageHelper.startPage(Integer.parseInt(pageNo),Integer.parseInt(pageSize));
        List<ArcRollImage> List=arcRollImageMapper.findAllRollImageList();
        PageInfo pageInfo = new PageInfo(List);
        return pageInfo;
    }

    @Override
    public void updateRollImageURl(String id, String rul) {
        arcRollImageMapper.updateRollImageRul(id,rul);
    }

    @Override
    public void updateRollImageNum(String id, String num) {
        arcRollImageMapper.updateRollImageNum(id,num);
    }
}
